const express = require('express')
const compresstion = require('compression')
const https = require('https')
const fs = require('fs')

// https 的配置
const options = {
  cert: fs.readFileSync('./full_chain.pem'),
  key: fs.readFileSync('./private.key')
}

const app = express()

// 一定要把这一行代码，写到 静态资源托管之前
app.use(compresstion()) // 开启 gzip 压缩，减小文件体积，使传输速度更快
app.use(express.static('./dist'))

app.listen(80, () => {
  console.log('服务已开启...在浏览器输入地址即可访问：http://127.0.0.1');
})

// https.createServer(options,app).listen(443)